package cn.service.web;

import cn.service.entiy.Order;
import cn.service.service.OrderService;
import com.lmk.core.web.support.api.RequestResult;
import com.lmk.core.web.support.api.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Map;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;


    @PostMapping("/api/order/buy")
    public int buyGoods(@RequestBody Order order) {
        return orderService.buyGoods(order);

    }

    @PostMapping("api/order/bill")
    public ArrayList<Order> bill(@RequestBody Map map){
        Long beginDate=(Long) map.get("beginDate");
        Long endDate=(Long) map.get("endDate");

        return orderService.getBill(beginDate,endDate);
    }
}
